home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / mapicode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  10.3 KB  |  249 lines

  1. /*
  2.  *  M A P I C O D E . H
  3.  *
  4.  *  Status Codes returned by MAPI routines
  5.  *
  6.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  7.  */
  8.  
  9. #ifndef MAPICODE_H
  10. #define MAPICODE_H
  11. #pragma option push -b
  12.  
  13.  
  14. #if defined (WIN32) && !defined (_WIN32)
  15. #define _WIN32
  16. #endif
  17.  
  18. /* Define S_OK and ITF_* */
  19.  
  20. #ifdef _WIN32
  21.  
  22. #include <winerror.h>
  23.  
  24. #endif
  25.  
  26. /*
  27.  *  MAPI Status codes follow the style of OLE 2.0 sCodes as defined in the
  28.  *  OLE 2.0 Programmer's Reference and header file scode.h (Windows 3.x)
  29.  *  or winerror.h (Windows NT and Windows 95).
  30.  *
  31.  */
  32.  
  33. /*  On Windows 3.x, status codes have 32-bit values as follows:
  34.  *
  35.  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  36.  *   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  37.  *  +-+---------------------+-------+-------------------------------+
  38.  *  |S|       Context       | Facil |               Code            |
  39.  *  +-+---------------------+-------+-------------------------------+
  40.  *
  41.  *  where
  42.  *
  43.  *      S - is the severity code
  44.  *
  45.  *          0 - SEVERITY_SUCCESS
  46.  *          1 - SEVERITY_ERROR
  47.  *
  48.  *      Context - context info
  49.  *
  50.  *      Facility - is the facility code
  51.  *
  52.  *          0x0 - FACILITY_NULL     generally useful errors ([SE]_*)
  53.  *          0x1 - FACILITY_RPC      remote procedure call errors (RPC_E_*)
  54.  *          0x2 - FACILITY_DISPATCH late binding dispatch errors
  55.  *          0x3 - FACILITY_STORAGE  storage errors (STG_E_*)
  56.  *          0x4 - FACILITY_ITF      interface-specific errors
  57.  *
  58.  *      Code - is the facility's status code
  59.  *
  60.  *
  61.  */
  62.  
  63. /*
  64.  *  On Windows NT 3.5 and Windows 95, scodes are 32-bit values
  65.  *  laid out as follows:
  66.  *  
  67.  *    3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  68.  *    1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  69.  *   +-+-+-+-+-+---------------------+-------------------------------+
  70.  *   |S|R|C|N|r|    Facility         |               Code            |
  71.  *   +-+-+-+-+-+---------------------+-------------------------------+
  72.  *  
  73.  *   where
  74.  *  
  75.  *      S - Severity - indicates success/fail
  76.  *  
  77.  *          0 - Success
  78.  *          1 - Fail (COERROR)
  79.  *  
  80.  *      R - reserved portion of the facility code, corresponds to NT's
  81.  *          second severity bit.
  82.  *  
  83.  *      C - reserved portion of the facility code, corresponds to NT's
  84.  *          C field.
  85.  *  
  86.  *      N - reserved portion of the facility code. Used to indicate a
  87.  *          mapped NT status value.
  88.  *  
  89.  *      r - reserved portion of the facility code. Reserved for internal
  90.  *          use. Used to indicate HRESULT values that are not status
  91.  *          values, but are instead message ids for display strings.
  92.  *  
  93.  *      Facility - is the facility code
  94.  *          FACILITY_NULL                    0x0
  95.  *          FACILITY_RPC                     0x1
  96.  *          FACILITY_DISPATCH                0x2
  97.  *          FACILITY_STORAGE                 0x3
  98.  *          FACILITY_ITF                     0x4
  99.  *          FACILITY_WIN32                   0x7
  100.  *          FACILITY_WINDOWS                 0x8
  101.  *  
  102.  *      Code - is the facility's status code
  103.  *  
  104.  */
  105.  
  106.  
  107.  
  108.  
  109. /*
  110.  *  We can't use OLE 2.0 macros to build sCodes because the definition has
  111.  *  changed and we wish to conform to the new definition.
  112.  */
  113. #define MAKE_MAPI_SCODE(sev,fac,code) \
  114.     ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  115.  
  116. /* The following two macros are used to build OLE 2.0 style sCodes */
  117.  
  118. #define MAKE_MAPI_E( err )  (MAKE_MAPI_SCODE( 1, FACILITY_ITF, err ))
  119. #define MAKE_MAPI_S( warn ) (MAKE_MAPI_SCODE( 0, FACILITY_ITF, warn ))
  120.  
  121. #ifdef  SUCCESS_SUCCESS
  122. #undef  SUCCESS_SUCCESS
  123. #endif
  124. #define SUCCESS_SUCCESS     0L
  125.  
  126. /* General errors (used by more than one MAPI object) */
  127.  
  128. #define MAPI_E_CALL_FAILED                              E_FAIL
  129. #define MAPI_E_NOT_ENOUGH_MEMORY                        E_OUTOFMEMORY
  130. #define MAPI_E_INVALID_PARAMETER                        E_INVALIDARG
  131. #define MAPI_E_INTERFACE_NOT_SUPPORTED                  E_NOINTERFACE
  132. #define MAPI_E_NO_ACCESS                                E_ACCESSDENIED
  133.  
  134. #define MAPI_E_NO_SUPPORT                               MAKE_MAPI_E( 0x102 )
  135. #define MAPI_E_BAD_CHARWIDTH                            MAKE_MAPI_E( 0x103 )
  136. #define MAPI_E_STRING_TOO_LONG                          MAKE_MAPI_E( 0x105 )
  137. #define MAPI_E_UNKNOWN_FLAGS                            MAKE_MAPI_E( 0x106 )
  138. #define MAPI_E_INVALID_ENTRYID                          MAKE_MAPI_E( 0x107 )
  139. #define MAPI_E_INVALID_OBJECT                           MAKE_MAPI_E( 0x108 )
  140. #define MAPI_E_OBJECT_CHANGED                           MAKE_MAPI_E( 0x109 )
  141. #define MAPI_E_OBJECT_DELETED                           MAKE_MAPI_E( 0x10A )
  142. #define MAPI_E_BUSY                                     MAKE_MAPI_E( 0x10B )
  143. #define MAPI_E_NOT_ENOUGH_DISK                          MAKE_MAPI_E( 0x10D )
  144. #define MAPI_E_NOT_ENOUGH_RESOURCES                     MAKE_MAPI_E( 0x10E )
  145. #define MAPI_E_NOT_FOUND                                MAKE_MAPI_E( 0x10F )
  146. #define MAPI_E_VERSION                                  MAKE_MAPI_E( 0x110 )
  147. #define MAPI_E_LOGON_FAILED                             MAKE_MAPI_E( 0x111 )
  148. #define MAPI_E_SESSION_LIMIT                            MAKE_MAPI_E( 0x112 )
  149. #define MAPI_E_USER_CANCEL                              MAKE_MAPI_E( 0x113 )
  150. #define MAPI_E_UNABLE_TO_ABORT                          MAKE_MAPI_E( 0x114 )
  151. #define MAPI_E_NETWORK_ERROR                            MAKE_MAPI_E( 0x115 )
  152. #define MAPI_E_DISK_ERROR                               MAKE_MAPI_E( 0x116 )
  153. #define MAPI_E_TOO_COMPLEX                              MAKE_MAPI_E( 0x117 )
  154. #define MAPI_E_BAD_COLUMN                               MAKE_MAPI_E( 0x118 )
  155. #define MAPI_E_EXTENDED_ERROR                           MAKE_MAPI_E( 0x119 )
  156. #define MAPI_E_COMPUTED                                 MAKE_MAPI_E( 0x11A )
  157. #define MAPI_E_CORRUPT_DATA                             MAKE_MAPI_E( 0x11B )
  158. #define MAPI_E_UNCONFIGURED                             MAKE_MAPI_E( 0x11C )
  159. #define MAPI_E_FAILONEPROVIDER                          MAKE_MAPI_E( 0x11D )
  160. #define MAPI_E_UNKNOWN_CPID                             MAKE_MAPI_E( 0x11E )
  161. #define MAPI_E_UNKNOWN_LCID                             MAKE_MAPI_E( 0x11F )
  162.  
  163. /* Flavors of E_ACCESSDENIED, used at logon */
  164.  
  165. #define MAPI_E_PASSWORD_CHANGE_REQUIRED                 MAKE_MAPI_E( 0x120 )
  166. #define MAPI_E_PASSWORD_EXPIRED                         MAKE_MAPI_E( 0x121 )
  167. #define MAPI_E_INVALID_WORKSTATION_ACCOUNT              MAKE_MAPI_E( 0x122 )
  168. #define MAPI_E_INVALID_ACCESS_TIME                      MAKE_MAPI_E( 0x123 )
  169. #define MAPI_E_ACCOUNT_DISABLED                         MAKE_MAPI_E( 0x124 )
  170.  
  171. /* MAPI base function and status object specific errors and warnings */
  172.  
  173. #define MAPI_E_END_OF_SESSION                           MAKE_MAPI_E( 0x200 )
  174. #define MAPI_E_UNKNOWN_ENTRYID                          MAKE_MAPI_E( 0x201 )
  175. #define MAPI_E_MISSING_REQUIRED_COLUMN                  MAKE_MAPI_E( 0x202 )
  176. #define MAPI_W_NO_SERVICE                               MAKE_MAPI_S( 0x203 )
  177.  
  178. /* Property specific errors and warnings */
  179.  
  180. #define MAPI_E_BAD_VALUE                                MAKE_MAPI_E( 0x301 )
  181. #define MAPI_E_INVALID_TYPE                             MAKE_MAPI_E( 0x302 )
  182. #define MAPI_E_TYPE_NO_SUPPORT                          MAKE_MAPI_E( 0x303 )
  183. #define MAPI_E_UNEXPECTED_TYPE                          MAKE_MAPI_E( 0x304 )
  184. #define MAPI_E_TOO_BIG                                  MAKE_MAPI_E( 0x305 )
  185. #define MAPI_E_DECLINE_COPY                             MAKE_MAPI_E( 0x306 )
  186. #define MAPI_E_UNEXPECTED_ID                            MAKE_MAPI_E( 0x307 )
  187.  
  188. #define MAPI_W_ERRORS_RETURNED                          MAKE_MAPI_S( 0x380 )
  189.  
  190. /* Table specific errors and warnings */
  191.  
  192. #define MAPI_E_UNABLE_TO_COMPLETE                       MAKE_MAPI_E( 0x400 )
  193. #define MAPI_E_TIMEOUT                                  MAKE_MAPI_E( 0x401 )
  194. #define MAPI_E_TABLE_EMPTY                              MAKE_MAPI_E( 0x402 )
  195. #define MAPI_E_TABLE_TOO_BIG                            MAKE_MAPI_E( 0x403 )
  196.  
  197. #define MAPI_E_INVALID_BOOKMARK                         MAKE_MAPI_E( 0x405 )
  198.  
  199. #define MAPI_W_POSITION_CHANGED                         MAKE_MAPI_S( 0x481 )
  200. #define MAPI_W_APPROX_COUNT                             MAKE_MAPI_S( 0x482 )
  201.  
  202. /* Transport specific errors and warnings */
  203.  
  204. #define MAPI_E_WAIT                                     MAKE_MAPI_E( 0x500 )
  205. #define MAPI_E_CANCEL                                   MAKE_MAPI_E( 0x501 )
  206. #define MAPI_E_NOT_ME                                   MAKE_MAPI_E( 0x502 )
  207.  
  208. #define MAPI_W_CANCEL_MESSAGE                           MAKE_MAPI_S( 0x580 )
  209.  
  210. /* Message Store, Folder, and Message specific errors and warnings */
  211.  
  212. #define MAPI_E_CORRUPT_STORE                            MAKE_MAPI_E( 0x600 )
  213. #define MAPI_E_NOT_IN_QUEUE                             MAKE_MAPI_E( 0x601 )
  214. #define MAPI_E_NO_SUPPRESS                              MAKE_MAPI_E( 0x602 )
  215. #define MAPI_E_COLLISION                                MAKE_MAPI_E( 0x604 )
  216. #define MAPI_E_NOT_INITIALIZED                          MAKE_MAPI_E( 0x605 )
  217. #define MAPI_E_NON_STANDARD                             MAKE_MAPI_E( 0x606 )
  218. #define MAPI_E_NO_RECIPIENTS                            MAKE_MAPI_E( 0x607 )
  219. #define MAPI_E_SUBMITTED                                MAKE_MAPI_E( 0x608 )
  220. #define MAPI_E_HAS_FOLDERS                              MAKE_MAPI_E( 0x609 )
  221. #define MAPI_E_HAS_MESSAGES                             MAKE_MAPI_E( 0x60A )
  222. #define MAPI_E_FOLDER_CYCLE                             MAKE_MAPI_E( 0x60B )
  223.  
  224. #define MAPI_W_PARTIAL_COMPLETION                       MAKE_MAPI_S( 0x680 )
  225.  
  226. /* Address Book specific errors and warnings */
  227.  
  228. #define MAPI_E_AMBIGUOUS_RECIP                          MAKE_MAPI_E( 0x700 )
  229.  
  230. /* The range 0x0800 to 0x08FF is reserved */
  231.  
  232. /* Obsolete typing shortcut that will go away eventually. */
  233. #ifndef MakeResult
  234. #define MakeResult(_s)  ResultFromScode(_s)
  235. #endif
  236.  
  237. /* We expect these to eventually be defined by OLE, but for now,
  238.  * here they are.  When OLE defines them they can be much more
  239.  * efficient than these, but these are "proper" and don't make
  240.  * use of any hidden tricks.
  241.  */
  242. #ifndef HR_SUCCEEDED
  243. #define HR_SUCCEEDED(_hr) SUCCEEDED((SCODE)(_hr))
  244. #define HR_FAILED(_hr) FAILED((SCODE)(_hr))
  245. #endif
  246.  
  247. #pragma option pop
  248. #endif  /* MAPICODE_H */
  249.